import {createStore} from 'vuex'

declare let SessionStorage: any;
const USER = "USER";

const store = createStore({
  state: {
    user: SessionStorage.get(USER) || {}
  },
  //对对象的同步操作
  mutations: {
    setUser(state, user) {
      state.user = user;
      SessionStorage.set(USER,user);
    }
  },
  //对对象的异步操作
  actions: {},
  modules: {}
})

export default store;
